import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'HELLO FLUTTER',
      home: Scaffold(
        appBar: AppBar(
          title: const Text('CONTAINER WIDGET'),
        ),
        body: Center(
          child: Container(
            // 子容器对其方式  center/centerRight/centerLeft 等9个方向以及(x,y)
            alignment: Alignment.centerRight,
            width: 300.0,
            height: 200.0,
            // color: Colors.cyan,
            // 内边距设置 EdgeInsets.all()/EdgeInsets.only/EdgeInsets.fromLTRB
            padding: const EdgeInsets.fromLTRB(20, 10,20, 10),
            // 外边距 同内边距设置
            margin: const EdgeInsets.only( left: 100.0),
            // 装饰器 设置背景和边框 与color属性会起冲突
            decoration: BoxDecoration(
              // 渐变颜色
              gradient: const LinearGradient(
                colors: [Colors.lightBlue, Colors.cyanAccent]
              ),
              // 边框
              border: Border.all(width: 5.0, color: Colors.black),
              // 圆角
              // borderRadius: BorderRadius.all(Radius.circular(20.0)),
              borderRadius: BorderRadius.circular(10.0),
            ),
            child: const Text('container Widget 组件'),
          ),
        )
      ),
    );
  }
}